package com.fqgj.sentry.biz.store.system;

import com.fqgj.sentry.api.domain.HitRule;
import com.fqgj.sentry.biz.store.es.data.Rule;

public class HitRuleToEsRuleConverter {

    public static Rule convert(HitRule hitRule, String ruleType, boolean isSingleHit) {
        Rule rule = new Rule();
        rule.setName(hitRule.getRuleName());
        rule.setSingleHit(isSingleHit);
        rule.setCategory(ruleType);
        rule.setType(hitRule.getDecisionType().shortValue());
        rule.setPriority(hitRule.getPriority().shortValue());
        rule.setValue(hitRule.getDecision());
        return rule;
    }
}
